package Day08;

import java.util.Scanner;

public class DemoString3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String username="梁正";
        String password="123";
        for (int i = 0; i <3 ; i++) {
            System.out.println("请输入用户名");
            String name=sc.nextLine();
            System.out.println("请输入密码");
            String psw=sc.nextLine();
            if(name.equals(username)&&psw.equals(password)){
                System.out.println("登录成功");
                break;
            }else if(2-i==0){
                System.out.println("登录失败，你的账户已经被锁定");
            }else {
                System.out.println("登录失败你还有"+(2-i)+"次机会");
            }
        }
    }
}
